/**
 * 分组分类排序
 * @param arr
 * @param label
 * @returns arr
 */
export function groudSort(arr: any[], label: string) {
  const map: any = {}
  const myArr = []
  for (let i = 0; i < arr.length; i++) {
    if (!map[arr[i][label]]) {
      myArr.push({
        [label]: arr[i][label],
        data: [arr[i]]
      })
      map[arr[i][label]] = arr[i]
    } else {
      for (let j = 0; j < myArr.length; j++) {
        if (arr[i][label] === myArr[j][label]) {
          myArr[j].data.push(arr[i])
          break
        }
      }
    }
  }
  return myArr
}
